<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>循环结构</title>
		<script src="js/vue.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<div id="app">
			<h3>循环数组1</h3>
			<ul>
				<li v-for='item in lists'>{{item}}</li>
			</ul>
			<h3>循环数组2</h3>
			<ul>
				<li :key='index' v-for='(item,index) in lists'>{{index+'----'+item}}</li>
			</ul>
			<h3>循环对象</h3>
			<ul>
				<!-- item就是对象的值 -->
				<li v-for='item in emps'>{{item}}</li>
			</ul>
			<ul>
				<!-- item就是对象的值 -->
				<li   v-for='(v,k,index) in emps'>{{v}}  {{k}}  {{index}} </li>
			</ul>
		</div>
		<script>
			let vm = new Vue({
				el: '#app',
				data: {
					lists: ['haoren', 'lucy', 'lily', 'jerry', 'tom', 'batman'],
					emps: {
						id: 1001,
						name: 'haoren',
						salary: 2000,
						hireDay: '2020-10-10'
					}
				},
				methods: {

				}
			});
		</script>
	</body>
</html>
